<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script>
    <style type="text/css">
        .hou {
            background-color: red;
        }

        .qian {
            width: 200px;
            height: 100px;
            background-color: chartreuse;
        }
    </style>
</head>

<body>
    <div id="app">
        <span v-for="(item, index) in getlist" :key="item.getname">
            <button @click="fu1(item.getname,index)"
                :class="{'hou' : getyanshi[index]}">{{item.getname}}</button>
        </span>
        <div v-show="name!=''">选择了&nbsp;&nbsp;&nbsp;<span :class="{qian:name!=''}">{{name}}</span></div>
    </div>
</body>
<script>
    var vm = new Vue({
        el: "#app",
        data: {
            getlist: [{ getname: 'HTML' }, { getname: 'java' }, { getname: 'Vue.js' }, { getname: 'C#' }],
            getyanshi: [false, false, false, false],
            name: ''
        },
        methods: {
            fu1: function (obj, index) {

                this.name = obj
                for (let i = 0; i < this.getyanshi.length; i++) {
                    this.getyanshi[i] = false
                }
                this.getyanshi[index] = !this.getyanshi[index]

            }
        }
    });  
</script>

</html>